/*
 * Copyright 2009 Max Kugland
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.splink.deepsplink.page {
	import org.splink.library.distributor.Devent;
	import org.splink.library.distributor.Dtype;
	import org.splink.library.distributor.IDistributor;

	/**
	 * A <code>PageEvent</code> is distributed by <code>IPage</code> implementations
	 * when their state changes.
	 * 
	 * @see org.splink.deepsplink.page.IPage
	 * @author Max Kugland
	 */
	final public class PageContainerEvent extends Devent {
		public static const PARAMS_CHANGED : Dtype = new Dtype("pageParamsChanged");		public static const INITIALIZED : Dtype = new Dtype("pageInitialized");		public static const SHOWN : Dtype = new Dtype("pageShown");		public static const HIDDEN : Dtype = new Dtype("pageHidden");

		private var _id : String;
		
		/**
		 * @param source the source of the <code>PageEvent</code>, usally an <code>IPage</code>
		 * @param type the type of the event, look at the <code>PageEvent</code> constants
		 * @param id the id of the page which distributes the event
		 */
		public function PageContainerEvent(source : IDistributor, type : Dtype, id : String) {
			super(source, type);
			_id = id;
		}
		
		/**
		 * @return the id of the corresponding <code>IPage</code>
		 */
		public function getId() : String {
			return _id;
		}
	}
}
